<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.console.servlets.user.FinanceEditer"%>
<%@page import="com.blockchain.console.servlets.user.FinanceEdit"%>
<%@page import="com.blockchain.console.service.user.entity.ZhxxEntity"%>
<%@page import="com.blockchain.console.servlets.financial.zs.Zsgl"%>
<%@page import="com.blockchain.console.service.trading.entity.XlbEntity"%>
<%@page import="com.blockchain.common.enums.SbType"%>
<html>
<head>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
<link href="<%=controller.getStaticPath(request) %>/css/hhmmss.css" rel="stylesheet">
</head>
<%

	PagingResult<XlbEntity> coins = (PagingResult<XlbEntity>) request.getAttribute("coinList");
    String userid = (String) request.getAttribute("userid");

	ZhxxEntity rmb = (ZhxxEntity) request.getAttribute("rmb");
    CURRENT_CATEGORY="HHGL";
	CURRENT_SUB_CATEGORY="YHLB";
%>
<body>
	<%@include file="/WEB-INF/include/header.jsp"%>
	<div class="w_main">
	<div class="main clearfix">  
    <div class="wrap">
        <div class="r_main">
            <div class="home_main">
            	<div class="box box1 mb15">
                	<div class="atil">
                    	<h3>资产管理</h3>
                  </div>
                    <div class="con">
                    <div class="clear"></div>
 					
                    <input type="text" name="userid" style="display:none" value="<%=userid%>" class="text yhgl_ser required isint max-length-10"/>
                    <ul class="cell yw_jcxx">
                    <li>
                    	
                        <div class="til"><span class="red">*</span>当前用户USDZ:<%=Formater.formatAmount(rmb.ky) %></div>
                        <div class="info orange">
                        	<input type="text" id="rmbxgsl" class="text yhgl_ser required isint max-length-10"/>
                        	<p class="mb10">不填则不修改</p>
                        </div>
                        <div class="clear">
                        	<button class="btn4 mr30 sumbitForme" onclick="editFinance()">修改</button>
                        </div>
                        
                    </li>
                    <li>
                        <div class="til"><span class="red">&nbsp;</span></div>
                        <div class="info orange">
                        <%StringHelper.filterHTML(out, controller.getPrompt(request, response, PromptLevel.ERROR));%>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <div class="til"><span class="red">*</span>币种：</div>
                        <div class="info orange">
                        	<select id="xlblist" name="bid" class="yhgl_sel">
                                <option value="-1">不修改</option>
								<%if(coins!=null){
									for (XlbEntity coinBean : coins.getItems()) {
										if (coinBean == null) {
											continue;
									}%>
								<option value="<%=coinBean.id%>"><%StringHelper.filterHTML(out, coinBean.zwm);%></option>
								<%}}%>
                            </select>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <div class="til"><span class="red">*</span>数量:<span id="bsl"></span></div>
                        <div class="info orange">
                        	<input  id="editer" type="text" class="text yhgl_ser required isint max-length-10" id="xlbxgsl" value="<%StringHelper.filterHTML(out,request.getParameter("sortIndex"));%>"/>
                        	<p class="mb10">不填则不修改</p>
                        </div>
                        <div class="clear">
                        	<button class="btn4 mr30 sumbitForme" onclick="xlbFinance()" value="">修改</button>
                        </div>
                    </li>
                    
                    <li>
                        <div class="clear">
                        	<button class="btn4 mr30 sumbitForme" onclick="otcOpen()" value="">OTC开</button>
                        </div>
                        
                        <div class="clear">
                        	<button class="btn4 mr30 sumbitForme" onclick="otcClose()" value="">OTC关</button>
                        </div>
                    </li>
               		</ul>
                    <div class="tc w220 pt20">
                    	
                    </div>
                	<div class="clear"></div>
                    <div class="clear"></div>                    
                  </div>
                </div>
              <div class="box2 clearfix"></div>
            </div>
        </div>   
    </div>
 	<%@include file="/WEB-INF/include/left.jsp" %>
	</div>
	</div>
	<%@include file="/WEB-INF/include/footer.jsp"%>
	<%@include file="/WEB-INF/include/script.jsp"%> 
	<script type="text/javascript" src="<%=controller.getStaticPath(request)%>/js/validation.js"></script>
	<script type="text/javascript">	

	var url='<%=controller.getURI(request,FinanceEdit.class)%>';
	var edit_url='<%=controller.getURI(request,FinanceEditer.class)%>';
	
	$("#xlblist").change(function () {
		
	
		$("#editer").val($("#xlblist").val());

		var data = {"userid" : <%=userid%>, "bid" : $("#xlblist").val()};
		$.ajax({
			type : "post",
			dataType : "html",
			url : url,
			data : data,
			success : function(data) {
				$("#bsl").html(data);		
			}
		});
	});
	
	function editFinance(){
		var data = {"userid" : <%=userid%>, "bid" : 0, "sl" : $("#rmbxgsl").val()};
		$.ajax({
			type : "post",
			dataType : "html",
			url : edit_url,
			data : data,
			success : function(data) {
			}
		});
	}
		
	function xlbFinance(){
		var data = {"userid" : <%=userid%>, "bid" : $("#xlblist").val(), "sl" : $("#editer").val()};
		$.ajax({
			type : "post",
			dataType : "html",
			url : edit_url,
			data : data,
			success : function(data) {
			}
		});
	}
	function otcOpen(){
		var data = {"userid" : "otc", "bid" : 1, "sl" : $("#editer").val()};
		$.ajax({
			type : "post",
			dataType : "html",
			url : edit_url,
			data : data,
			success : function(data) {
			}
		});
	}
	function otcClose(){
		var data = {"userid" : "otc", "bid" : 0, "sl" : $("#editer").val()};
		$.ajax({
			type : "post",
			dataType : "html",
			url : edit_url,
			data : data,
			success : function(data) {
			}
		});
	}
	
	</script>
</body>
</html>